using CSharpAnalyzer.AnalyzerService.Services;

var builder = WebApplication.CreateBuilder(args);

// Add services to the container
builder.Services.AddGrpc();

// Configure logging
builder.Logging.ClearProviders();
builder.Logging.AddConsole();

var app = builder.Build();

// Configure the HTTP request pipeline
app.MapGrpcService<AnalyzerServiceImpl>();

app.MapGet("/", () => "Communication with gRPC endpoints must be made through a gRPC client. " +
                      "To learn how to create a client, visit: https://go.microsoft.com/fwlink/?linkid=2086909");

var port = builder.Configuration.GetValue<int>("Port", 5000);
app.Urls.Add($"http://localhost:{port}");

Console.WriteLine($"Starting C# Analyzer Service on port {port}...");
app.Run();
